package com.zhong.bmob.server;

import com.zhong.bmob.inter.IRegisterUserDown;
import com.zhong.bmob.model.User;

import cn.bmob.v3.exception.BmobException;
import cn.bmob.v3.listener.SaveListener;

/**
 * Created by 俊峰 on 2017/5/15.
 * 用于调用Bmob的注册功能
 */

public class Register {
    public static void userRegister(User user, IRegisterUserDown mUserDown){
        final IRegisterUserDown registerUserDown = mUserDown;
        user.signUp(new SaveListener<User>() {
            @Override
            public void done(User user, BmobException e) {
                if (e == null){
                    registerUserDown.registerSuccess(user);
                } else {
                    registerUserDown.registerFail(e);
                }
            }
        });
    }
}
